package com.gcb.service.impl;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.gcb.domain.Channel;
import com.gcb.domain.ChannelExt;
import com.gcb.repository.ChannelExtRepository;
import com.gcb.repository.ChannelRepository;
import com.gcb.service.ChannelExtService;

/**
 * @author Cre.Gu
 * 
 */
@Service
public class ChannelExtServiceImpl implements ChannelExtService {
	protected static final org.slf4j.Logger log = org.slf4j.LoggerFactory
			.getLogger(ChannelExtServiceImpl.class);

	@Resource
	private ChannelExtRepository repository;
	@Resource
	private ChannelRepository channelRepository;

	@Override
	public ChannelExt save(ChannelExt ext, Channel channel) {
		ext.setChannel(channelRepository.findOne(channel.getId()));
		ext.setId(channel.getId());
		repository.save(ext);
		return ext;
	}

}
